fix(config): fail with a clear error when numeric env vars are malformed#150
Conversation
MEDCHECK_PORT, MEDCHECK_MAX_VISION_IMAGES and MEDCHECK_MAX_DOWNLOAD_BYTES were parsed with bare int() inside dataclass default factories, so a typo like MEDCHECK_PORT=8080a crashed startup with a raw ValueError traceback. Parse via an _env_int helper that raises a one-line SystemExit naming the variable and value (silently falling back would hide a misconfigured port or cap). Empty/whitespace values use the default. Fixes #141 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4svt5QTs4WUMSy4HwiVt9
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
MEDCHECK_PORT,MEDCHECK_MAX_VISION_IMAGESandMEDCHECK_MAX_DOWNLOAD_BYTESwere parsed with bareint()inside dataclass default factories, so a typo likeMEDCHECK_PORT=8080acrashed app/CLI startup with a rawValueErrortraceback from deep inside dataclass construction. Values are now parsed via an_env_inthelper that exits with a one-line error naming the variable and offending value. Silently falling back to the default was deliberately rejected — a wrong port or download cap should not be ignored.Fixes #141
Changes
src/medcheck/core/config.py: new_env_int(name, default)helper — clearSystemExiton malformed values, default on unset/empty, tolerates surrounding whitespace; used for all three numeric fieldstests/unit/test_core/test_config.py: 4 new tests (malformed port, malformed byte cap, empty/whitespace → default, whitespace-padded valid value)Testing
uv run pytest) — 172 passeduv run pytest --cov-fail-under=85) — 87.14%uv run ruff check .)uv run mypy src/medcheck --strict)🤖 Generated with Claude Code
https://claude.ai/code/session_01W4svt5QTs4WUMSy4HwiVt9
Generated by Claude Code